public class Student implements Comparable<Student>{
    @Override
    public int compareTo(Student o) {
        int sum1=this.getChinese() +this.getEnglish()+this.getMath();
        int sum2=o.getChinese() +o.getEnglish()+o.getMath();
        int i=sum1-sum2;
        i=i==0?this.getChinese() -o.getChinese():i;

        i=i==0?this.getMath() -o.getMath():i;
        i=i==0?this.getEnglish() -o.getEnglish():i;
        i=i==0?this.getAge() -o.getAge() :i;
        i=i==0?this.getName().compareTo(o.getName()) :i;
        return i ;
    }

    private String name;
    private int age;
    private int Chinese;
    private int Math;
    private int English;

    public Student() {
    }

    public Student(int age, int chinese, int english, int math, String name) {
        this.name = name;
        this.age = age;
        Chinese = chinese;
        English = english;
        Math = math;

    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getChinese() {
        return Chinese;
    }

    public void setChinese(int chinese) {
        Chinese = chinese;
    }

    public int getEnglish() {
        return English;
    }

    public void setEnglish(int english) {
        English = english;
    }

    public int getMath() {
        return Math;
    }

    public void setMath(int math) {
        Math = math;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", Chinese=" + Chinese +
                ", Math=" + Math +
                ", English=" + English +
                '}';
    }
}
